Skip to content

build(test-redis-cache-module): Migrate from pip to uv#48

Merged
ericapisani merged 1 commit into
mainfrom
PY-2475-test-redis-cache-module
May 21, 2026
Merged

build(test-redis-cache-module): Migrate from pip to uv#48
ericapisani merged 1 commit into
mainfrom
PY-2475-test-redis-cache-module

Conversation

@ericapisani

Copy link
Copy Markdown
Member

Summary

  • Replace requirements.txt with pyproject.toml for dependency management
  • Update run.sh and run-locust.sh to use uv run instead of manual venv/pip workflow
  • Part of PY-2428 migration effort

Test plan

  • Run ./run.sh and verify redis-server starts and the app runs correctly
  • Run ./run-locust.sh and verify locust starts correctly

🤖 Generated with Claude Code

Replace requirements.txt with pyproject.toml and update run.sh and
run-locust.sh to use uv for dependency management and script execution.

Refs PY-2475
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear-code

linear-code Bot commented May 21, 2026

Copy link
Copy Markdown

PY-2475

PY-2428

Comment on lines +5 to +13
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

pkill redis-server || true
sleep 1
rm -rf dump.rdb
redis-server --daemonize yes

# Run program
python main.py No newline at end of file
uv run python main.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The script installs uv but doesn't update the current shell's PATH, causing the subsequent uv run command to fail if uv wasn't already installed.
Severity: HIGH

Suggested Fix

To make uv available in the current shell session, source the environment file created by the installer immediately after installation. Add source ~/.local/bin/env after the curl command that installs uv. Alternatively, you could add ~/.local/bin to the PATH manually with export PATH="$HOME/.local/bin:$PATH".

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.

Location: test-redis-cache-module/run.sh#L5-L13

Potential issue: After installing `uv` via its curl installer, the script immediately
calls `uv run`. The installer modifies shell profile files (e.g., `.bashrc`), but these
changes only apply to new shell sessions, not the currently running script.
Consequently, if `uv` is not pre-installed and its binary directory (`~/.local/bin`) is
not already in the `PATH`, the `uv run` command will fail with a "command not found"
error. Because `set -euo pipefail` is active, this error will cause the script to exit
prematurely. This issue also affects `run-locust.sh`.

Also affects:

  • run-locust.sh

Did we get this right? 👍 / 👎 to inform future reviews.

@ericapisani ericapisani merged commit 171b979 into main May 21, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant